﻿@using ZKEACMS.Shop.ViewModel
@model OrderListViewModel
@{
    Layout = Layouts.CustomerCenter;
    ViewBag.Title = "我的订单";
}
<div class="panel panel-default">
    <div class="panel-heading">
        我的订单
    </div>
    <table class="table table-striped table-hover table-response">
        <thead>
            <tr>
                <th>
                    订单号
                </th>
                <th>
                    金额
                </th>
                <th>
                    联系人
                </th>
                <th>
                    联系电话
                </th>
                <th>
                    收货地址
                </th>
                <th>
                    订单日期
                </th>
                <th>
                    状态
                </th>
                <th>
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model.Orders)
            {
                <tr class="@(item.OrderStatus == (int)ZKEACMS.Shop.OrderStatus.UnPaid?"warning":"")">
                    <td head="订单号">
                        <a href="@Url.Action("Detail", new { Id = item.ID })">@item.ID</a>
                    </td>
                    <td head="金额">
                        @item.Total.ToString("F2")
                    </td>
                    <td head="联系人">
                        @item.Contact
                    </td>
                    <td head="联系电话">
                        @item.PhoneNumber
                    </td>
                    <td head="收货地址">
                        @item.ShippingAddress
                    </td>
                    <td head="订单日期">
                        @item.CreateDate.Value.ToString("yyyy/MM/dd")
                    </td>
                    <td head="状态">
                        @item.OrderStatusText()
                    </td>
                    <td head="操作">
                        @if (item.OrderStatus == (int)ZKEACMS.Shop.OrderStatus.UnPaid)
                        {
                            <a href="@Url.Action("Pay", "AliPay", new { orderId = item.ID })">付款</a>
                        }
                        <a class="remove-order" href="javascript:" data-href="@Url.Action("Remove", new { Id = item.ID })">删除</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
@{
    Html.Pagin(Model.Pagin);
}
@using (Script.AtFoot())
{
    <script type="text/javascript">
        $(document).on("click", ".remove-order", function () {
            var href = $(this).data("href");
            Easy.ShowMessageBox('提示', '确定删除订单吗？', function () { window.location.href = href; }, true);
        })
    </script>

}